Weird ILIKE behavior

Поиск
Список
Период
Сортировка
От Keith C. Klopfer
Тема Weird ILIKE behavior
Дата
Msg-id r02010000-1032-FDEE948844D111D8BD47000393BA4D6A@[10.0.1.7]
обсуждение исходный текст
Список pgsql-jdbc
Hello,

I'm driving myself crazy trying to understand some weird behavior with a SELECT using ILIKE.  I'm
using a prepared statement:

String sql = "SELECT * FROM business WHERE name ILIKE ? ORDER BY name;";
PreparedStatement stmt = conn.prepareStatement(sql);
String s = "%" + query + "%";
stmt.setString(1, s);

I have a business with name: "PETCO - Beaverton" (this has been confirmed numerous times!)

When the variable query = "petco", it doesn't match. When query is "p", "pe", "pet", "etc" it matches
fine.  It also doesn't match when query is "petc" or "tco".  Case doesn't seem to have an effect.
Running from psql matches all of the above, but when used with the java/jdbc code above, it fails in
the above few cases (and the most important one - "petco"!). I've confirmed using print statements
that query contains the "correct" string immediately before the String s = line.

Any ideas?  I can't seem to find any more examples of this weird behaviour with other business
names...

Thanks,

Keith K.


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: JDBC parse error with preparedStatement!
Следующее
От: "John Sidney-Woollett"
Дата:
Сообщение: Re: jdbc pooling question